<template>
	<div>
		<ul>
			<li v-for="item in arr" :key="item">
				 {{item}}<!-- vue变量的值放入页面显示 -->
			</li>
		</ul>
		<button @click="revBtn">数组翻转</button>
		<button @click="sliceBtn">截取前3个</button>
		<button @click="fn">新增一个</button>
		<button @click="updateBtn">更新第一个元素值</button>
	</div>
</template>

<script>
	export default {
		data(){
			return{
				arr:[1,4,6,7,9,12,41,15,34,52,61]
			}
		},
		methods:{
			revBtn(){
				//反转可以让v-for更新
				 this.arr.reverse()
			},
			sliceBtn(){
				this.arr = this.arr.slice(0,3)
			},
			fn(){
				this.arr.push(60)
			},
			updateBtn(){
				this.$set(this.arr,0,1000)
			}
		}
	}
</script>

<style>

</style>
